home *** CD-ROM | disk | FTP | other *** search
-
-
-
- Ulog C Library Procedures Ulog
-
-
-
- _________________________________________________________________
-
- NNAAMMEE
- Ulog - obtain or update information in the database of user
- logins and logouts.
-
- SSYYNNOOPPSSIISS
- ##iinncclluuddee <<uulloogg..hh>>
-
- Ulog_Data *
- UUlloogg__LLaassttLLooggiinn(_u_i_d)
-
- int
- UUlloogg__GGeettAAllllLLooggiinnss(_n_u_m_E_n_t_r_i_e_s, _l_o_c_P_t_r, _d_a_t_a_A_r_r_a_y)
-
- int
- UUlloogg__RReeccoorrddLLooggiinn(_u_i_d, _l_o_c_a_t_i_o_n, _p_o_r_t_I_D)
-
- int
- UUlloogg__RReeccoorrddLLooggoouutt(_u_i_d, _p_o_r_t_I_D)
-
- int
- UUlloogg__CClleeaarrLLooggiinnss()
-
-
- AARRGGUUMMEENNTTSS
- int _u_i_d (in) A numerical identifier
- for a user for whom to
- retrieve or update
- information.
-
- int _n_u_m_E_n_t_r_i_e_s (in) The number of Ulog_Data
- structures contained in
- _d_a_t_a_A_r_r_a_y.
-
- int *_l_o_c_P_t_r (in/out) A pointer to an integer
- specifying the index of
- the next record in the
- user log to access.
-
- Ulog_Data _d_a_t_a_A_r_r_a_y[] (out) A buffer to hold
- Ulog_Data entries
- returned by the
- Ulog_GetAllLogins rou-
- tine.
-
- char *_l_o_c_a_t_i_o_n (in) String specifying loca-
- tion of user logging in
- (i.e., remote host)
-
- int _p_o_r_t_I_D (in) Numerical identifier for
- login port.
-
-
-
- Sprite v.1.0 Printed: January 3, 1989 1
-
-
-
-
-
-
- Ulog C Library Procedures Ulog
-
-
-
- _________________________________________________________________
-
- DDEESSCCRRIIPPTTIIOONN
- The ulog library provides a facility to record logins and
- logouts in the system, to retrieve information about the
- last time a user logged in or about all users logged into
- the system, and to clear the login entries for a host. Each
- host has a fixed number of entries allocated to it in the
- user log database file. One entry, with a _p_o_r_t_I_D of
- UULLOOGG__LLOOCC__CCOONNSSOOLLEE, is reserved for the console of a host;
- there are (UULLOOGG__MMAAXX__PPOORRTTSS - 1) other entries available for
- rlogin processes. (There is currently no facility for mul-
- tiple local logins, such as over a serial line.)
-
- The _u_l_o_g library converts between the ASCII representation
- stored in the database and an internal C structure, known as
- a Ulog_Data structure. This structure contains information
- giving <uid,hostID,portID> corresponding to a user logged in
- on a particular ``port'' on a particular host. Each login
- entry also includes the time of the login, which is the
- ttvv__sseecc part of a ttiimmee structure. It also includes any addi-
- tional information for the location of the user; this is an
- arbitrary string that typically gives the host from which an
- rlogin occurs. Two database files are used: one for logins
- on a host/port basis, and one for the last login by each
- user.
-
- A Ulog_Data structure is defined as follows:
-
- ttyyppeeddeeff ssttrruucctt {
- iinntt _u_i_d; /* user identifier */
- iinntt _h_o_s_t_I_D; /* host for which data is
- valid */
- iinntt _p_o_r_t_I_D; /* port within host */
- iinntt _u_p_d_a_t_e_d; /* login time (in seconds since
- 1/1/70); 0 if invalid */
- cchhaarr _l_o_c_a_t_i_o_n[UULLOOGG__LLOOCC__LLEENNGGTTHH];
- /* location of user */
- } Ulog_Data;
-
- The UUlloogg__LLaassttLLooggiinn(()) procedure returns a pointer to a
- statically-allocated Ulog_Data structure. Therefore, the
- contents of the structure may change on subsequent calls to
- UUlloogg__LLaassttLLooggiinn(()). The information returned by
- UUlloogg__LLaassttLLooggiinn(()) corresponds to the most recent login by the
- user specified by _u_i_d.
-
- UUlloogg__GGeettAAllllLLooggiinnss(()) provides a mechanism for retrieving mul-
- tiple login entries at once. The user must allocate an
- array of Ulog_Data structures, and pass the size of the
- array and a pointer to it as arguments to
- UUlloogg__GGeettAAllllLLooggiinnss(()). In addition, the _l_o_c_P_t_r argument
-
-
-
- Sprite v.1.0 Printed: January 3, 1989 2
-
-
-
-
-
-
- Ulog C Library Procedures Ulog
-
-
-
- specifies where in the login database to start looking.
- *_l_o_c_P_t_r should be initialized to 0 prior to the first call
- to UUlloogg__GGeettAAllllLLooggiinnss(()). UUlloogg__GGeettAAllllLLooggiinnss(()) returns the
- number of entries in _d_a_t_a_A_r_r_a_y that were filled. If that
- number is less than the maximum number specified by _n_u_m_E_n_-
- _t_r_i_e_s, then all data has been returned. If it is equal to
- _n_u_m_E_n_t_r_i_e_s, then UUlloogg__GGeettAAllllLLooggiinnss(()) should be called again
- to retrieve additional entries from the point at which the
- last call left off (given by *_l_o_c_P_t_r).
-
- UUlloogg__RReeccoorrddLLooggiinn(()) allows the caller to register information
- for a new login. The caller specifies the user ID, loca-
- tion, and port of the user logging in. The procedure
- obtains the hostID and current time, and records the login.
-
- UUlloogg__RReeccoorrddLLooggoouutt(()) provides a similar facility to record
- logouts. It takes a user ID and port number, and it removes
- the corresponding loginn from the list of active logins.
-
- UUlloogg__CClleeaarrLLooggiinnss(()) may be used at boot time to clear any old
- entries in the user log for the current host. Note: if a
- host is down, it may still have entries in the user log. It
- is the responsibility of the user to use the migration
- information database to determine if a host is up, in order
- to validate user log entries.
-
- DDIIAAGGNNOOSSTTIICCSS
- UUlloogg__RReeccoorrddLLooggiinn(()), UUlloogg__RReeccoorrddLLooggoouutt(()), and
- UUlloogg__CClleeaarrLLooggiinnss(()) return zero if all went well. Otherwise
- they return -1 and the _e_r_r_n_o variable contains additional
- information about what error occurred. UUlloogg__GGeettAAllllLLooggiinnss(())
- similarly returns -1 on error, but it returns 0 if no more
- records are available. UUlloogg__LLaassttLLooggiinn(()) returns NULL on
- error.
-
- FFIILLEESS
- /sprite/admin/data/userLog
- The database of current logins on each host.
-
- /sprite/admin/data/lastLog
- The database of each user's most recent login.
-
- KKEEYYWWOORRDDSS
- user log, user ID, sprite ID
-
- SSEEEE AALLSSOO
- db, mig, Mig_GetInfo, login, rlogin, rlogind
-
-
-
-
-
-
-
-
- Sprite v.1.0 Printed: January 3, 1989 3
-
-
-
-